import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const routes = [
    {
        path: '/student/index',
        name: 'STUDENT_HOME',
        component: () => import('../views/StudentMain'),
        redirect: '/student/index/exam',
        children: [
            {
                path: '/student/index/exam',
                name: 'STUDENT_EXAM',
                component: () => import('../components/StudentComponents/StudentExam/Exam'),
                redirect: '/student/index/exam/now',
                children: [
                    {
                        path: '/student/index/exam/now',
                        name: 'EXAM_NOW',
                        component: () => import('../components/StudentComponents/StudentExam/ExamNow')
                    },
                    {
                        path: '/student/index/exam/history',
                        name: 'EXAM_HISTORY',
                        component: () => import('../components/StudentComponents/StudentExam/ExamHistory')
                    },
                    {
                        path: '/student/index/exam/future',
                        name: 'EXAM_FUTURE',
                        component: () => import('../components/StudentComponents/StudentExam/ExamComing')
                    }
                ]
            },
            {
                path: '/student/index/info',
                name: 'STUDENT_INFO',
                component: () => import('../components/StudentComponents/StudentInfo')
            }
        ]
    },
    {
        path: '/teacher/index',
        name: 'TEACHER_HOME',
        component: () => import('../views/TeacherMain'),
        children: [
            {
                path: '/teacher/index/email',
                name: 'TEACHER_EMAIL',
                component: () => import('../components/TeacherComponents/TeacherEmail')
            },
            {
                path: '/teacher/index/problemset',
                name: 'TEACHER_PROBLEM_SET',
                component: () => import('../components/TeacherComponents/ProblemSet')
            },
            {
                path: '/teacher/index/examcorner',
                name: 'TEACHER_CORNER',
                component: () => import('../components/TeacherComponents/ExamManageCorner')
            },
            {
                path: '/teacher/index/examhistory',
                name: 'TEACHER_EXAM_HISTORY',
                component: () => import('../components/TeacherComponents/ExamHistroy')
            },
            {
                path: '/teacher/index/exammonitor',
                name: 'TEACHER_EXAM_MONITOR',
                component: () => import('../components/TeacherComponents/ExamMonitor')
            }
        ]
    },
    {
        path: '/admin/index',
        name: 'ADMIN_HOME',
        component: () => import('../views/AdminMain'),
        redirect: '/admin/index/introduce',
        children: [
            {
                path: '/admin/index/introduce',
                name: 'ADMIN_INTRODUCE',
                component: () => import('../components/AdminComponents/AdminIntroduce')
            },
            {
                path: '/admin/index/exammanage',
                name: 'ADMIN_EXAM_MANAGE',
                component: () => import('../components/AdminComponents/SchoolManage/ExamManage')
            },
            {
                path: '/admin/index/studentmanage',
                name: 'ADMIN_STUDENT_MANAGE',
                component: () => import('../components/AdminComponents/SchoolManage/StudentManage')
            },
            {
                path: '/admin/index/teachermanage',
                name: 'ADMIN_TEACHER_MANAGE',
                component: () => import('../components/AdminComponents/SchoolManage/TeacherManage')
            },
            {
                path: '/admin/index/syslog',
                name: 'ADMIN_SYS_LOG',
                component: () => import('../components/AdminComponents/SystemManage/SystemLog')
            },
            {
                path: '/admin/index/sysemail',
                name: 'ADMIN_SYS_ADMIN',
                component: () => import('../components/AdminComponents/SystemManage/SystemEmail')
            }
        ]
    },
    {
        path: '/',
        name: 'INDEX',
        component: () => import('../views/Index')
    },
    {
        path: '/paper/:id',
        name: 'PAPER',
        component: () => import('../views/PaperMain')
    },
    {
        path: '/user',
        name: 'USER',
        redirect: '/user/login',
        component: () => import('../views/UserInterface'),
        children: [
            {
                path: '/user/login',
                name: 'LOGIN',
                component: () => import('../components/UserComponents/Login')
            },
            {
                path: '/user/register',
                name: 'REGISTER',
                component: () => import('../components/UserComponents/Register')
            },
        ]
    }
];

const router = new VueRouter({
    routes,
    mode: 'history'
});

export default router
